<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">
	<span class="color_red">*</span>${param.title }${param.unit }
</div>
	<table  id="tblMileStones2" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="organization_finances/financeborder:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="25%">起止年月</th>
						<th class="TblHead" align="center" width="30%" >工作单位</th> 
						<th class="TblHead" align="center" width="20%">职务</th>
						<th class="TblHead" align="center" width="20%">职称</th>
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td align="center">
							<input type="radio" class="radiobutton" name="selMileStones2" >
						</td>
						<!-- <td align="center">&nbsp;
							<span name="milestones|milestone[0]@seq_no" >[index]</span> 
						</td> -->
						<td align="center" nowrap="nowrap">
						<input  id="milestone2_start_date_[0]" name="milestones|milestone2[0]|start_date" label="开始日期"value="" class=" required input_text date  dateCompare:milestone2_end_date_[0] dateCompareAfterE:milestone2_start_date_[0]:start_date" style="width:70px" label="开始日期" />
						至
						<input  id="milestone2_end_date_[0]" name="milestones|milestone2[0]|end_date" label="结束日期" value="" class=" required input_text date dateCompareBeforeE:milestone2_end_date_[0]:end_date " style="width:70px" label="结束日期" /> 
						</td> 						
						<td align="center">
							<input name="milestones|milestone2[0]|content1" label="工作单位" value="" class=" required input_text "  maxlength="100" style="width:80%" />
						</td>
						<td align="center">
							<input name="milestones|milestone2[0]|content2" label="职务" value="" class=" required input_text "  maxlength="20" style="width:80%" />
						</td> 
						<td align="center" nowrap="nowrap">						
							<cpt:tree id="prof_title_[index]" key="prof_title" cacheable="false" readonly="true" label="职称"  className="hn_iuput_kuang required selectWidth3" value="" name="prof_title"  showPattern="all" shieldPattern="0" onClick="initTreeValue2" width="70%" />
							<input type="hidden" name="milestones|milestone2[0]|prof_title_value" value="" /> 
							<input type="hidden" name="milestones|milestone2[0]|prof_title_name" value="" />
						</td>	
							
					</tr>
					
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/milestones/milestone2" var="milestone2">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr >
						<td align="center">
							<input type="radio" class="radiobutton" name="selMileStones2" >
						</td>
						<%-- <td align="center">
							<span   name="milestones/milestone[${flag}${index}]@seq_no" ><x:out select="$milestone/@seq_no"/></span> 
						</td> --%>
						<td align="center" nowrap="nowrap">
							<c:set var="start_date" scope="page"><x:out select="$milestone2/start_date"/></c:set>
							<input  id="milestone2_start_date_[${flag}${index}]" value="${start_date}" label="开始日期" name="milestones/milestone2[${flag}${index}]/start_date" class="required date input_text dateCompare:milestone2_end_date_[${flag}${index}] dateCompareAfterE:milestone2_start_date_[${flag}${index}]:start_date"  style="width:70px" label="开始日期" /> 
						至
							<c:set var="end_date" scope="page"><x:out select="$milestone2/end_date"/></c:set>
							<input  id="milestone2_end_date_[${flag}${index}]" value="${end_date}" label="结束日期"  name="milestones/milestone2[${flag}${index}]/end_date"  class="required date input_text dateCompareBeforeE:milestone2_end_date_[${flag}${index}]:end_date" style="width:70px" label="结束日期" /> 
						</td>  
						<td align="center">
							<input value="<x:out select="$milestone2/content1"/>" label="工作单位" name="milestones/milestone2[${flag}${index}]/content1" maxlength="100" class="required"  style="width:80%"  /> 
						</td>
						<td align="center">
							<input value="<x:out select="$milestone2/content2"/>" label="职务" name="milestones/milestone2[${flag}${index}]/content2" maxlength="20" class="required"  style="width:80%"  /> 
						</td>
						<td align="center" nowrap="nowrap">
							<%-- <c:set var="title_value"><x:out select="$milestone2/title_value" /></c:set>
							<cpt:select id="title_${index}" key="title"  name="title"  value="${title_value }" className="required" label="职称" style="width:85%"></cpt:select>
							<input type="hidden" name="milestones/milestone2[${flag}${index}]/title_value" value="<x:out select="$milestone2/title_value" />"/>
							<input type="hidden" name="milestones/milestone2[${flag}${index}]/title_name" value="<x:out select="$milestone2/title_name" />"/> --%>
							
						<c:set var="prof_title">{'id':'<x:out select="$milestone2/prof_title_value" />','name':'<x:out select="$milestone2/prof_title_name" />'}</c:set>
						<cpt:tree id="prof_title_${index}" key="prof_title" cacheable="false" readonly="true" value="${prof_title}" className="hn_iuput_kuang required selectWidth3" name="prof_title"  showPattern="all" shieldPattern="0" onClick="initTreeValue2"   label="职称" width="70%" />	
						<input type="hidden" name="milestones/milestone2[${flag}${index}]/prof_title_value" value="<x:out select="$milestone2/prof_title_value" />" /> 
						<input type="hidden" name="milestones/milestone2[${flag}${index}]/prof_title_name" value="<x:out select="$milestone2/prof_title_name" />" /> 
							
						</td>
						</tr>
	
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
						showAllDateTag("tblMileStones2");
					</script>
				</tbody>
					</table>
					<br/>

					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblMileStones2',99,'${param.title }最多只能填写99条')){addNewRow('tblMileStones2');showDateTag('tblMileStones2');}try{top.resizeFrame();}catch(e){};">
					<!--
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblMileStones',5,'项目进度信息最多只能填写5条')){addNewRow('tblMileStones');}showDateTag('tblMileStones');try{top.resizeFrame();}catch(e){};">
                    -->
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblMileStones2','selMileStones2')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblMileStones2','selMileStones2')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblMileStones2','${param.title }')">
					</td></tr>
	</table>
	<br/>
<script type="text/javascript">
$(function() {
	$("#tblMileStones2 tr:even").addClass("li_1");
	$("#tblMileStones2 tr:odd").addClass("li_2");
});
function initTreeValue2(treeId, treeNode) {
  	//针对单位性质
  	if (( treeNode && treeNode.isParent)) {
		scmWarn("请选择具体的"+$("#" + treeId).attr("label"));
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_code'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_code']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_value'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_value']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_name'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_name']").val("");
			return false;
	}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			//str = obj.name + "-" + str;
			obj = obj.parentNode;
		}
		$("#" + treeId).parents("td").find("[name$='" +  treeId.substr(0,treeId.lastIndexOf("_")) + "_code'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" +  treeId.substr(0,treeId.lastIndexOf("_")) + "_value'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" +  treeId.substr(0,treeId.lastIndexOf("_")) + "_name'],[id$='" + treeId.substr(0,treeId.lastIndexOf("_")) + "_name']").val(str);
		$("#" + treeId).val(str);
		initTreeValue2CallBack();
	}
</script>